#include "iMsgThread.h"
#include "iTimerThread.h"

uint8_t iMsgThread::s_index = 0;
iMsgThread::iMsgThread(void)
{
    m_index = s_index++;
    m_q_slots.resize(256,NULL);
    m_q_slots[m_index] = new iRingQueue<iMsg>();
}

iMsgThread::~iMsgThread(void)
{
}

int iMsgThread::on_message(iMsgID msg, void* param)
{
	return 0;
}
int iMsgThread::run()
{
	while(m_runing)
	{
		iMsg* msg = get_message();
		if(NULL == msg)
		{
			wait();
		}
		else
		{
			msg->process();
		}
	}
	
	return 0;
}
